package socket;

import com.jfinal.kit.PropKit;
import demo.JfinalConfig;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Administrator on 2016/11/4.
 */
public class QuerySchedule {

    public void start() {
        new Timer().schedule(new MyTask(), 0, 1 * 3600);
    }

    class MyTask extends TimerTask {

        private int i = 0;

        @Override
        public void run() {
            System.out.println("-----------" + (i++));

            //VER1.00 2004/05/10
            String str = PropKit.get("client.version", "VER1.07 ")
                    + new SimpleDateFormat("yyyy/MM/dd").format(new Date());
            TCPEchoClient.main(new String[]{PropKit.get("client.ip", "localhost"), str, PropKit.get("client.port")});

        }
    }

    public static void main(String[] args) {
        JfinalConfig.start();
        new QuerySchedule().start();
    }
}
